home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-06-23 | 2.6 KB | 157 lines | [TEXT/CWIE] |
- // ===========================================================================
- // LIconPane.cp ©1995-1996 Metrowerks Inc. All rights reserved.
- // ===========================================================================
- //
- // Pane which draws a single icon from an icon family
-
- #ifdef PowerPlant_PCH
- #include PowerPlant_PCH
- #endif
-
- #include "LIconSuitePane.h"
- #include <LStream.h>
- #include <PP_Constants.h>
-
- #ifndef __ICONS__
- #include <Icons.h>
- #endif
-
-
- LIconSuitePane*
- LIconSuitePane::CreateIconPaneStream(
- LStream *inStream)
- {
- return (new LIconSuitePane(inStream));
- }
-
-
- LIconSuitePane::LIconSuitePane()
- {
- mIconSuiteH = nil;
- }
-
-
- LIconSuitePane::LIconSuitePane(
- const SPaneInfo &inPaneInfo,
- ResIDT inIconID)
- : LPane(inPaneInfo)
- {
- InstallIconUtilitiesPatches ( );
-
- Debugger ();
-
- GetIconSuite ( & mIconSuiteH, inIconID, kSelectorAllAvailableData );
- }
-
-
- LIconSuitePane::LIconSuitePane(
- LStream *inStream)
- : LPane(inStream)
- { short iconID;
- inStream->ReadData(&iconID, sizeof(ResIDT));
-
- InstallIconUtilitiesPatches ( );
-
- GetIconSuite ( & mIconSuiteH, iconID, kSelectorAllAvailableData );
- }
-
-
- LIconSuitePane::~LIconSuitePane()
- {
- DisposeIconSuite ( mIconSuiteH, true );
- }
-
-
- void
- LIconSuitePane::SetIconID(
- Handle iconSuite)
- {
- if ( mIconSuiteH )
- DisposeIconSuite ( mIconSuiteH, true );
-
- mIconSuiteH = iconSuite;
- Refresh();
- }
-
-
- void
- LIconSuitePane::DrawSelf()
- {
- Rect frame;
- CalcLocalFrameRect(frame);
-
- PlotIconSuite(&frame, atNone, ttNone, mIconSuiteH);
- }
-
-
- LIconRefPane*
- LIconRefPane::CreateIconRefPaneStream(
- LStream *inStream)
- {
- return (new LIconRefPane(inStream));
- }
-
-
- LIconRefPane::LIconRefPane()
- {
- mIconRef = nil;
- }
-
-
- LIconRefPane::LIconRefPane(
- const SPaneInfo &inPaneInfo,
- ResIDT inIconID)
- : LPane(inPaneInfo)
- {
- InstallIconServicesPatches ( );
-
- Debugger ();
-
- FSSpec spec;
-
- if ( FSMakeFSSpec ( 0, 0, "\pBasic PowerPlant 68k", & spec ) == noErr )
- GetIconRefFromFileInfo ( & spec, & mIconRef, '\?\?\?\?', 'APPL', true );
- }
-
-
- LIconRefPane::LIconRefPane(
- LStream *inStream)
- : LPane(inStream)
- { short iconID;
- inStream->ReadData(&iconID, sizeof(ResIDT));
-
- InstallIconServicesPatches ( );
-
- FSSpec spec;
-
- if ( FSMakeFSSpec ( 0, 0, "\pBasic PowerPlant 68k", & spec ) == noErr )
- GetIconRefFromFileInfo ( & spec, & mIconRef, '\?\?\?\?', 'APPL', true );
- }
-
-
- LIconRefPane::~LIconRefPane()
- {
- DisposeIconRef ( mIconRef );
- }
-
-
- void
- LIconRefPane::SetIconID(
- IconRef iconRef )
- {
- if ( mIconRef )
- DisposeIconRef ( mIconRef );
-
- mIconRef = iconRef;
- Refresh();
- }
-
-
- void
- LIconRefPane::DrawSelf()
- {
- Rect frame;
- CalcLocalFrameRect(frame);
-
- PlotIconRef (&frame, atNone, ttNone, 0, mIconRef);
- }